<script>
  import $ from '../dfish.js'
  import WidgetBase from './WidgetBase.vue'

  export default {
    name: 'w-swiper-item',
    pubParentName: 'w-swiper',
    inject: ['providePubParent'],
    mixins: [WidgetBase],
    props: ['lazy'],
    data() {
      return {
        loaded: false,
      }
    },
    methods: {
      x_default() {
        return {
          lazy: true
        }
      },
      html_slots() {
        if (this.loaded || !this.lazy) {
          return this.$slots
        }
        if (this.isCurrent) {
          this.loaded = true
          return this.$slots
        }
      }
    },
    computed: {
      html_class() {
        return {'z-on': this.isCurrent}
      },
      isCurrent() {
        return this.pubParent.inCurrent(this)
      }
    }
  }
</script>

<style>

</style>
